package  com.game.raceroom.player.effect.skill
{
	import flash.utils.getTimer;
	
	import com.game.raceroom.player.Player;
	import com.game.raceroom.player.effect.Effect;
	public class HideEffect extends Effect
	{   
		private var actor:Player;
		private var isLocal:Boolean;
		public function HideEffect(actor:Player,isLocal:Boolean)
		{  
			this.actor=actor;
			this.effectType= EFFECT_TYPE_HIDE;
			this.isLocal=isLocal;
			startTime=getTimer();
			maxTime=6000;
		 }
		 private var alpha:Number=1;
         public function getShowStep():int{
         	var time:int=getTimer()-startTime;
            if(time<=500){
            	alpha=(500-time)/500;
            	if(isLocal)
            	   alpha=alpha/2+0.5;
            	
            }else if(time<=maxTime){
            	alpha=0;
            	if(isLocal)
            	   alpha=0.5;	
            }
         	 if(time>maxTime){

         	   alpha=alpha+0.1;
         	   if(alpha>=1){ 
         	     alpha=1;
         	     hide(alpha);
         	     return 999;
         	   }
         	 }
         	  hide(alpha);
         	 return 0;
         }
         private function hide(alpha:Number):void{
             actor.actorDisp.hide(alpha);
         }
         private var scale:Number=1.0;
         public override function update():Boolean{
			
         	   var step:int=getShowStep();
 
         	   if(step==999){
  
         	        valid=false;
         	   }
         	 
        	 return true;
         }
	}
}